package com.trinity.payment;

import java.util.List;

/**
 * 账单
 */
public class Bill {
    private Person person;
    private List<FeeOption> selectedOptions;
    private double totalAmount;

    public Bill(Person person, List<FeeOption> selectedOptions) {
        this.person = person;
        this.selectedOptions = selectedOptions;
        this.totalAmount = calculateTotal();
    }

    private double calculateTotal() {
        return selectedOptions.stream().mapToDouble(FeeOption::getAmount).sum();
    }
}
